<?php
function litimgurls($imgid=0)
{
    global $lit_imglist,$dsql;
    //获取附加表
    $row = $dsql->GetOne("SELECT c.addtable FROM #@__archives AS a LEFT JOIN #@__channeltype AS c
                                                            ON a.channel=c.id where a.id='$imgid'");
    $addtable = trim($row['addtable']);

    //获取图片附加表imgurls字段内容进行处理
    $row = $dsql->GetOne("Select imgurls From `$addtable` where aid='$imgid'");

    //调用inc_channel_unit.php中ChannelUnit类
    $ChannelUnit = new ChannelUnit(2,$imgid);

    //调用ChannelUnit类中GetlitImgLinks方法处理缩略图
    $lit_imglist = $ChannelUnit->GetlitImgLinks($row['imgurls']);

    //返回结果
    return $lit_imglist;
}


/**
 *时间格式化
 *by zsh
 */
function format_time($format = "Y-m-d H:i:s",$time = ""){
    return date($format,strtotime($time));
}

/**
 *根据院校id字符串返回院校名
 *by zsh
 */
function get_schools($ids){
    global $dsql;
     if(empty($ids)){
        return "";
    }else{
        $ids = explode(',', $ids);
        // 获取schools 学校数组 键值为院校id
        $sql = "select collegeId,name from `#@__collegeinfo`";
        $dsql->SetQuery($sql);
        $dsql->Execute();
        $schools = array();
        while($row = $dsql->GetArray()){
            $schools[$row['collegeId']] = $row['name'];
        }
        $result = "";
        foreach ($ids as $id) {
            if(!isset($schools[$id])){
                continue;
            }
            $result .= $schools[$id] . ",";
        }
        return trim($result,",");
    }
}

function get_level($index){
    $level = array("博士","硕士","大本","大专");
    return $level[intval($index)];
}

?>